/* 储存订单管理相关store */

import { defineStore } from 'pinia';
import router from '@/router';
// import { useRouter } from 'vue-router';

// const router = useRouter();

const useOrderStore = defineStore('order', {
  state: () => {
    return {
      product: {},
      currState: 2, // 储存客户详情的状态
      currClientName: '', // 储存客户详情当前客户的名称
      currContactName: '', // 储存客户详情当前首要联系人名称
      orderInfo: {}, // 储存订单详情-回款详情使用
      getTemplateControl: [
        {
          componentName: '单行文本',
          componentType: 'TEXT',
          code: 'TEXT',
          icon: 'icon-danhangwenben',
          showFieldList: ['validate', 'textMax', 'placeholder'],
          props: {
            placeholder: '请输入文字',
          },
          type: '0',
        },
        {
          componentName: '多行文本',
          componentType: 'TEXT_AREA',
          code: 'TEXT_AREA',
          icon: 'icon-duohangwenben',
          showFieldList: ['textMax', 'placeholder'],
          props: {
            placeholder: '请输入文字',
          },
          type: '0',
        },
        {
          componentName: '产品',
          componentType: 'TABLE',
          code: 'TABLE',
          icon: 'icon-biaoge',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '附件',
          componentType: 'FILE',
          code: 'FILE',
          icon: 'icon-fujian',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '部门',
          componentType: 'DEPARTMENT',
          code: 'DEPARTMENT',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '岗位',
          componentType: 'POST',
          code: 'POST',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '客户名称',
          componentType: 'CLIENT',
          code: 'CLIENT',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '客户编号',
          componentType: 'CLIENT_NUMBER',
          code: 'CLIENT_NUMBER',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '联系人姓名',
          componentType: 'CONTACT_NAME',
          code: 'CONTACT_NAME',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '联系地址',
          componentType: 'ADDRESS',
          code: 'ADDRESS',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '0',
        },
        {
          componentName: '交货要求',
          componentType: 'DELIVERY_REQUIREMENTS_BC',
          code: 'DELIVERY_REQUIREMENTS_BC',
          icon: 'icon-biaoge',
          showFieldList: ['placeholder'],
          props: {},
          type: '1-1',
        },
        {
          componentName: '付款方式',
          componentType: 'CONTRACT_PAYMENT',
          code: 'CONTRACT_PAYMENT',
          icon: 'icon-yuangong',
          templateType: 3,
          showFieldList: ['placeholder'],
          props: {},
        },
        {
          componentName: '发票类型',
          componentType: 'INVOICE_TYPE',
          code: 'INVOICE_TYPE',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '2',
        },
        {
          componentName: '发票税率',
          componentType: 'INVOICE_RATE',
          code: 'INVOICE_RATE',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '2',
        },
        {
          componentName: '单位抬头',
          componentType: 'COMPANY_TITLE',
          code: 'COMPANY_TITLE',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '2',
        },
        {
          componentName: '收款账户',
          componentType: 'RECEIVING_ACCOUNT',
          code: 'RECEIVING_ACCOUNT',
          icon: 'icon-yuangong',
          showFieldList: ['placeholder'],
          props: {},
          type: '2',
        },
        // {
        //   componentName: '关联合同',
        //   componentType: 'CONTRACT_SELECT',
        //   code: 'CONTRACT_SELECT',
        //   icon: 'icon-yuangong',
        //   showFieldList: ['placeholder'],
        //   props: {},
        //   type: '2',
        // },
      ], // 储存订单模板显示控件
      // 销售订单转出库单
      getOutboundData: [],
    };
  },

  actions: {},
});

export default useOrderStore;
